perm filename MUSIC.TVR[UP,DOC]3 blob sn#134552 filedate 1974-12-07 generic text, type T, neo UTF8
                            Music Manual


                  T A B L E   O F   C O N T E N T S



                               SECTION                           PAGE


1      Changes    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 2
            1-1       Changes to the Music Compiler
                              (NEWMUS) .  .  .  .  .  .  .  .  .  . 2
            1-2       TAPNEW and CONNEW   .  .  .  .  .  .  .  .  . 3
            1-3       Changes to UDPLAY   .  .  .  .  .  .  .  .  . 3
2      Declarations  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 4
            2-1       Identifiers   .  .  .  .  .  .  .  .  .  .  . 4
            2-2       Variable Declaration   .  .  .  .  .  .  .  . 4
            2-3       Array Declaration   .  .  .  .  .  .  .  .  . 5
            2-4       Function declaration   .  .  .  .  .  .  .  . 5
3      Expressions   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 8
            3-1       Function Call:   .  .  .  .  .  .  .  .  .  . 8
            3-2       Unit Generator Call .  .  .  .  .  .  .  .  . 9
4      Statements .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   10
            4-1       Function Call:   .  .  .  .  .  .  .  .  .   10
            4-2       Unit Generator Call .  .  .  .  .  .  .  .   10
            4-3       WHILE Statement  .  .  .  .  .  .  .  .  .   11
            4-4       UNTIL Statement  .  .  .  .  .  .  .  .  .   11
            4-5       FOR Statement .  .  .  .  .  .  .  .  .  .   11
            4-6       PRINT Statement  .  .  .  .  .  .  .  .  .   12
            4-7       Assignment Statement   .  .  .  .  .  .  .   12
            4-8       Block   .  .  .  .  .  .  .  .  .  .  .  .   13
5      Extended Commands   .  .  .  .  .  .  .  .  .  .  .  .  .   14
6      Unit Generators  .  .  .  .  .  .  .  .  .  .  .  .  .  .   16
            6-1       Controlled Calling Rates  .  .  .  .  .  .   16
            6-2       VFMULT  .  .  .  .  .  .  .  .  .  .  .  .   16
            6-3       LINEN   .  .  .  .  .  .  .  .  .  .  .  .   17
            6-4       VALUE   .  .  .  .  .  .  .  .  .  .  .  .   17
            6-5       The OSCIL family of Unit Generators   .  .   18
            6-6       The ZOSCIL Family of Unit Generators  .  .   19
7      Built-in Functions  .  .  .  .  .  .  .  .  .  .  .  .  .   21
            7-1       SYNTH   .  .  .  .  .  .  .  .  .  .  .  .   21
            7-2       SEG  .  .  .  .  .  .  .  .  .  .  .  .  .   21
            7-3       SEE  .  .  .  .  .  .  .  .  .  .  .  .  .   22
            7-4       SETSPEED   .  .  .  .  .  .  .  .  .  .  .   22
            7-5       PRINT   .  .  .  .  .  .  .  .  .  .  .  .   22
            7-6       RDNUM   .  .  .  .  .  .  .  .  .  .  .  .   23
            7-7       RAND .  .  .  .  .  .  .  .  .  .  .  .  .   23
            7-8       INT  .  .  .  .  .  .  .  .  .  .  .  .  .   23
            7-9       FORTRAN Functions   .  .  .  .  .  .  .  .   24
8      Making Music  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   25

                                Page 
                            Music Manual


Appendix A     Syntax   .  .  .  .  .  .  .  .  .  .  .  .  .  .   26
Appendix B     Reserved Words .  .  .  .  .  .  .  .  .  .  .  .   29
Appendix C     Error Messages.   .  .  .  .  .  .  .  .  .  .  .   30














































                               Page i
Music Manual


                              SECTION 1
                              _______ _

                               Changes
                               _______




Most of the problems which  caused the message ILL MEM REF  have been
eliminated.   If  come  across  any problems  or  have  any  needs or
suggestions,  Please bring  them  to my  attention by  saying  to the
Monitor:

.MAIL TVR


The MAIL program will explain itself.



1-1  Changes to the Music Compiler (NEWMUS)
___  _______ __ ___ _____ ________ ________


The  sample  output routines  have  been rewritten  to  eliminate the
BIGBIT  kludge.  The  intermediate files  whose extensions  have been
MUSAA.DMD are  now in the  form: <file name>.<integer>,  for example:
TEST.0,  TEST.1, TEST.2,...  Now more  than one  set  of intermediate
files may be  on the disk at  one time an any  set may be  deleted by
saying DEL <file name>.*, for example DEL TEST.*. The format has also
been changed, since it is  no longer done with FORTRAN.   Therefore a
new  conversion  program has  also  been written  to  replace CONNEW,
called  NMUSIO. GARPLY  is still  used to  play from  the  disk.  For
details, see Page 25.

The error printout routines now contain an option to continue,  or to
edit, to retry, or to debug with DDT.

Core is  obtained automatically, whenever  possible.  It  still loses
under certain circumstances.

Play now prints the run time used in computing the samples.

When the Compiler asks for  an input file, it is no  longer necessary
to precede a file name with DSK:.  If just a return is typed, TTY: is
assumed.

The Compiler will accept files editted by TVED or E.



                               Page 2
Music Manual                                                  Changes


When inputting  from the TTY,  SYNTH and SEG  will display  the array
being filled.

NEWMUS should generate slightly better code for constants.

Array  elements  may  be  individually  referenced.   This  allows as
complex waveforms  as can  be described  by a  mathematic expression,
instead of the previous restrictions of combination of sine  waves or
approximation by line segments.

There is a  new set of statements  and block structure  added.  These
statements include  IF,  WHILE,  UNTIL and  FOR statements.   A print
statement  has  been  added  which  allows  literal  strings  so that
messages may be printed as well as numbers, which are now  printed in
floating point notation.  The literal strings  may also be  passed to
functions. In order to  use certain routines in the  FORTRAN Library,
the data type INTEGER has been added but is currently limited  to the
external functions  until type  conversion code can  be added  to the
compiler.

Functions may now be blocks as well as expressions.

There is a new extend mode command: FREEZE.

To make debugging the  compiler easier, a special debugging  mode has
been added.



1-2  TAPNEW and CONNEW
___  ______ ___ ______


TAPNEW and CONNEW  will not work with  NEWMUS, please read  about new
scheme on  .  Note  that tapes written  in the  old format  should be
read with the old programs.



1-3  Changes to UDPLAY
___  _______ __ ______


UDPLAY now detects the previously mysterious premature end  of sound.
Also,  a  problem  in  the old  version  caused  it  to  do excessive
computation which often caused  the lossage described above  has been
corrected. It  also new  checks the validity  of your  responses, and
will restart if you type altmode or backspace.



                               Page 3
Music Manual


                              SECTION 2
                              _______ _

                            Declarations
                            ____________






2-1  Identifiers
___  ___________


<identifier>            ::= <letter>{<alphanumeric>}
<alphanumeric>          ::= <letter>|<number>
<letter>                ::= A|B|C|...Z|_|$|#
<digit>                 ::= 0|1|2|...9


An identifier always  begins with a letter  and may be  followed with
any number of  letters or digits.   There are three  characters which
are treated as letters, $,   and _.  Lower case letters are converted
                        _        _
to upper case.  Certain  identifiers have special meanings  which may
not be used as names for variables, functions, arrays or instruments.
There  are  two kinds,  P  and U  variables,  which are  of  the form
P<number> and U<number>  (see Page 4)  and reserved words  like ARRAY
_             _                                                 _____
or BEGIN.  A list of reserved words is contained in  Appendix SECTION
   _____
.



2-2  Variable Declaration
___  ________ ___________


<variable declaration>  ::= VARIABLE <identifier>{,<identifier>};


All  variables must  be declared  before they  are used.   A variable
declaration consists of the reserved word VARIABLE followed by a list
of identifiers to  be declared as  variables.  All variables  must be
declared before they are used.  If they are to be used  during R-Time
(see Page  , they must  be declared as  R-Time variable  by preceding
the variable name with a slash in their declaration.

All variables are stored in floating pointer notation.

There are certain  variables, P1,P2,P3,..Pn and  U1,U2,U3,...Un which
have special meanings. Pn is the nth element of the P_Array, which is


                               Page 4
Music Manual                                             Declarations


the  list  of  parameters  to  an  instrument.  Within  an instrument
definition, Un is  the output of the  nth unit generator  within that
instrument definition.

Example:

VARIABLE A,B,/C,D,/RT;  COMMENT Declares A,B,D to be I-Time variables
                                Declares C,RT to be R-Time variables;



2-3  Array Declaration
___  _____ ___________


<array declaration>     ::= ARRAY <array decl. list>
<array decl. list>      ::= <variable>[(<constant>)]{,<array decl. li
                        <variable>(<constant>)

All  arrays  must  be  declared  before  they  are  used.   An  array
declaration consists of  the reserved word  ARRAY followed by  a list
consisting  of  the  identifier   followed  by  the  array   size  in
parenthesis, separated by commas.  If there are several arrays of the
same size, the size may be omitted on all but the last array  of that
size.  Arrays are currently restricted to single  subscripts.  Arrays
within blocks  are not dynamically  allocated(1); they  are allocated
are compile time, hence they must be a fixed size.

Example:

ARRAY F1,F2,F3(512),BAZ(2000);  COMMENT Declares F1, F2, F3 to be
                                arrays of length 512, BAZ to be an
                                array of length 2000;



2-4  Function declaration
___  ________ ___________


<function declaration>  ::= FUNCTION <identifier>(<formal list>)
                                <function tail>|
                            EXTERNAL FUNCTION <identifier>(<formal li
<formal list>           ::= <formal declaration>{,<formal list>}
<formal declaration>    ::= ARRAY <identifier> | INTEGER <identifier>
                            STRING <identifier> | <identifier>
<function tail>         ::= ; <block> | = <expression>

_______________________
(1) Dynamic allocation will probably be implemented in the future.

                               Page 5
Music Manual                                             Declarations


A  function declaration  defines a  function in  NEWMUS.   A function
takes from 0 to 2n arguments, which may be variables,  arrays, string
constants or expressions and returns a value, which is a real number.
Functions are executed at  either I-time or R-time, depending  on the~types of the arguments.

The function declaration includes  a list of formal  parameters, call
take  on the  values  of their  respective reall  arguments  when the
function is called.  The formal parameters are local  variables, that
is they are known only  within the function which they  are declared.
Outside  that  function,   they  are not  defined  or  may  have some
different definition.

Functions are always called  by reference(1), which means that  if an
assignment

formal  parameters,  the  argument  itself  will  be  modified.  Such
assignments  are discouraged,  as if  the function  is called  with a
constant  as an  argument, the  constant's value  will  change, which
usually has disastorous results.

There are three  forms of function  declaration.  In the  first form,
the value of the function is the value of the expression to the right
of the  the =.   For example, the  following function  calculates the
            _
cube of a number.

FUNCTION CUBE(X) = X * X * X;

PRINT CUBE(2);
8.


The second form is used for more complex functions.  Its value is the
expression part  of the  last RETURN  statement executed  within that
                              ______
function,  as  there may  be  more  than one  RETURN  statement  in a
                                              ______
function.  For example,   the following function returns  the maximum
amplitude of an waveform contained in an array.









_______________________
(1) This is the FORTRAN IV standard calling sequence on the PDP-10.

                               Page 6
Music Manual                                             Declarations



FUNCTION AMPLITUDE(ARRAY M);
  BEGIN VARIABLE I,MAX;
    MAX←0;                  COMMENT Initialize maximum amplitude;
    FOR I ← 0 STEP 1 UNTIL LENGTH(M)
      DO IF ABS(M[I])>MAX THEN MAX←ABS(M[I]);
                            COMMENT Compare each element with
                                current maximum;
    RETURN MAX;             COMMENT The value of the function is
                                the maximum amplitude found;
    END;


The third form  is used for functions  written in FORTRAN  or machine
code.  It defines the argument list which the function expects to see
and fetchs the address from DDT's symbol table.  This means  that you
must to  use the same  name for  the function as  was written  in the
program or  NEWMUS will not  find its address!   The following  is an
example of this form of declaration.

EXTERNAL FUNCTION SQRT(X);

WARNING:  The syntax for  formal declaration will be changed  soon to
conform to ALGOL.

























                               Page 7
Music Manual


                              SECTION 3
                              _______ _

                             Expressions
                             ___________




<expression>    ::= <simple expr><relop><simple expr>|<simple expr>
<simple expr>   ::= <term>|<term><addop><simple expr>
<term>          ::= <factor>|<factor><mulop><term>
<factor>        ::= <primary>
<primary>       ::= -<primary>|(<expression>)|<function call>|
                    <unit generator call>|<variable>←<expression>|
                    <variable>|<array name>(expression)|<constant>
<relop>         ::= <|=|>|α≤|≠|≥
<addop>         ::= +|-
<mulop>         ::= *|/


Expressions are like algebraic formulae with certain changes required
so that they may  be typed on a  keyboard.  For example, '*`  is used
instead of 'x` and '/`  has been used to indicate division.   The use
of parenthesis is similar, but the following:

                3+45
                _____
                 72

should be  written as (3+4*5)/(7*2),  not 3+4*5/7*2.  When  in doubt,
put in the extra parenthesis.  In mathematical notation, there  is an
implied  multiplication   frequently  used   which  must   be  stated
explicitly in NEWMUS,  therefore 2x+3 should be written as  2*X+3. It
                                                            _____
is  also  necessary  to  expiicately  parenthesis  the  arguments  to
functions which would not  be required in mathematical  notation, for
example, sin  x should be  written as SIN(X).   Relational operators,
                                      ______
(as in x>4) are defined to evaluate to 0 if false and 1 if true.



3-1  Function Call:
___  ________ _____


<function call> ::= <function>(<parameter list>)
<parameter list>::= <parameter>,<parameter list>|<parameter>
<parameter>     ::= <expression>|<array>|<string constant>


A function call consists of  the function name followed by a  list of


                               Page 8
Music Manual                                              Expressions


parameters  separated by  commas  and enclosed  by  parenthesis.  The
effect is  to call  the function  (or subroutine)  with that  list of
parameters.  If the function is  not defined to return a  value, such
as a FORTRAN subroutine, the  value of the function is  undefined and
may be almost anything. For additional information on  functions, see
Page 5.  For descriptions of  the built-in functions  available,  see
Page 21.

Example:

PRINT SQRT(2);

1.414213



3-2  Unit Generator Call
___  ____ _________ ____


A unit  generator is a  special kind of  function, as it  may contain
both at I-time and  R-time code and requires  special initialization,
Hence a unit generator call is only legal within an instrument.  Note
that a unit generator call within an expression can not be refered to
by Un.   Only unit generators  used as statements  are counted  for U
   _                                                                _
symbols.  See Section 16.
























                               Page 9
Music Manual


                              SECTION 4
                              _______ _

                             Statements
                             __________



<statement>     ::= <function call>|<unit generator call>|
                    <WHILE statement>|<UNTIL statement>|
                    <FOR statement>|<conditional statement>|
                    <PRINT statement>|<assignment statement>|
                    <block>



4-1  Function Call:
___  ________ _____

<function call> ::= <function>(<parameter list>)
<parameter list>::= <parameter>,<parameter list>|<parameter>
<parameter>     ::= <expression>|<array>|<string constant>


A function call consists of  the function name followed by a  list of
parameters  separated by  commas  and enclosed  by  parenthesis.  The
effect is  to call  the function  (or subroutine)  with that  list of
parameters.  If the function returns a value, that value is lost.

Example:

SYNTH(F1);              COMMENT Call the function SYNTH with F1
                                as an argument;



4-2  Unit Generator Call
___  ____ _________ ____

<unit generator call> ::= <unit generator>(<parameter list>)|
                <unit generator>[<expression>](<parameter list>)


A unit  generator is a  special kind of  function, as it  may contain
both at I-time and  R-time code and requires  special initialization,
Hence a unit generator call  is only legal within an  instrument. The
value of nth unit generator in an instrument can be refered to by Un.
                                                                  _
Only unit generators used as statements are counted for U symbols, if
                                                        _
a unit generator is used  with an expression it is not  counted.  See
Section 16.



                               Page 10
Music Manual                                               Statements


4-3  WHILE Statement
___  _____ _________

<WHILE statement> ::= WHILE <conditional> DO <statement>

A WHILE statement consists of the reserved word WHILE, an expression,
                                                _____
called  the  condition  followed  by  the  reserved  word  DO  and  a
                                                           __
statement.  So long  as the  condition is  true, i.e.  not  zero, the
statement will  be repeated  indefinitely.  Generally,  the statement
affects  part   of  the  condition   and  the   statement  eventually
terminates.

Example:

I←1; WHILE I<1000 DO PRINT(I←2*I);

2. 4. 8. 16. 32. 64. 128. 256. 512. 1024.



4-4  UNTIL Statement
___  _____ _________


<UNTIL Statement> ::= DO <statement> UNTIL <conditional>

An  UNTIL  statement  is  like an  WHILE  statement  except  that the
statement is executed before  the condition and loop  terminates when
the  condition is  true.   It consists  of  the reserved  word  DO, a
                                                                __
statement followed by the reserved word UNTIL and an  expression, the
                                        _____
condition.

Example:

I←10; DO PRINT(I←I-1) UNTIL I≤0;

9. 8. 7. 6. 5. 4. 3. 2. 1. 0



4-5  FOR Statement
___  ___ _________


<FOR statement> ::= FOR <variable>←<expression> STEP <expression> 
                      UNTIL <expression> DO <statement>

This performs the statement for each value of the variable, beginning
with the expression immediately following the '←` in steps defined by
the second expression until it is greater than the  third expression.


                               Page 11
Music Manual                                               Statements


The value  of the variable  will always be  the last value  which was
less than the third  expression.  If the first expression  is greater
than the third expression,  the statement will be  skipped altogether
and the variable unchanged.

Example:

FOR I←0 STEP 2 UNTIL 20 PRINT(I);

0 2. 4. 6. 8. 10. 12. 14. 16. 18. 20.



4-6  PRINT Statement
___  _____ _________


<PRINT statement> ::= PRINT <print list>
<print list>      ::= <expression>,<print list>|<expression>|
                      <string constant>,<print list>|
                      <string constant>

This  types each  number or  string in  the print  list.  Numbers are
printed  in free  field format  with a  trailing space.   Strings are
printed  without a  leading  or trailing  space and  may  include any
character.  To enter a double  quote, precede it with ≡ and  to enter
                                                      _
≡, put in two consecutive ≡.
_                         _

Example:
PRINT "SQRT(2) = ",SQRT(2);

SQRT(2) = 1.41423



4-7  Assignment Statement
___  __________ _________


<assignment statement> ::= <variable>←<expression>

This statement assigns the value of the expression to the variable to
the left of the '←`.   Caution: Assignment to formal parameters  of a
function can have unexpected results;  see PAGE .

Example:

I←123;          COMMENT Set the value of the variable 'I` to 123;



                               Page 12
Music Manual                                               Statements


4-8  Block
___  _____


<block> ::= BEGIN <declaration list>;<statement list>
<declaration list> ::= <declaration>;<declaration list>|<declaration>
<statement list> ::= <statement>;<statement list>|END

A Block  is a  list of  statements, brackets  by the  reserved words,
BEGIN and  END and  separated by  the semicolons.   Anything declared
within a block is not known outside that block, but anything which is
declared outside a block may be referenced within that block provided
that it has not  been redefined.  Thus variables names  within blocks
maybe chosen without being concerned with name conflicts.

Example:

VARIABLE X; X←123; PRINT X;

123.

BEGIN VARIABLE X,Y;  X←456; Y←789;  PRINT X,Y;  END;

456. 789.

PRINT X;

123.

PRINT Y;

ERROR:  UNDEFINED IDENTIFIER    Line = 7 /1
PRINT Y;
       ↑
??















                               Page 13
Music Manual


                              SECTION 5
                              _______ _

                          Extended Commands
                          ________ ________




These commands may be entered at the top level by preceding them with
an <alt mode> (which is echoed as $).
                                  _

Exit:                        <alt mode>EXIT
____

Return to Monitor.

Play:                        <alt mode>P <integer>
____

Plays the music buffered in  core the specified number of  times.  If
no argument is given, one is assumed.

Save:                        <alt mode>SAVE
____

Saves the music buffered in  core on a disk file.  At  Stanford, this
is in 12 bit format.

Print:                       <altmode>PRINT <expression>;
_____

Prints the value of the expression. It is now an  ordinary statement.
See Print Statement on Page 12.

Reset:                       <alt mode>RESET
_____

Deletes all instruments, arrays, and variable.   Essentially restores
the compiler  to the  state which  it was  in when  it was  loaded or
frozen.

Freeze:                      <alt mode>FREEZE
______

Make the present state of  NEWMUS into the initial state  and reduces
to the  minimum core required.   Return to the  Monitor to  allow the
core image to be saved.  If a RESET is later done in this core image,
                              _____
it will return to this saved state.

Reduce Core size:            <alt mode>EXCISE
______ ____ ____

Reduces to the minimum core required.

SPACE:                       <alt mode>SPACE
_____


                               Page 14
Music Manual                                        Extended Commands


Prints the total  space available followed  by the core  buffer space
and the number of seconds of sound which may be produced.

DDT:                         <alt mode>DDT
___

Starts up RAID or DDT. [Not usually loaded in system version  but may
be in other core images.]

Printing the Symbol Table:   <alt mode><declarator> LIST
________ ___ ______ _____

This list  the contents of  the symbol table.  Please note  that this
does not include symbols in inner blocks.  The following types may be
listed:

        VARIABLE
        FUNCTION
        ARRAY
        INSTRUMENT
        UNIT_GENERATOR






























                               Page 15
Music Manual


                              SECTION 6
                              _______ _

                           Unit Generators
                           ____ __________




Consider producing the  sound of a simple  sine wave.  If one  had to
call the  sine subroutine  for each  sample, it  would take  about   
minutes to  compute a second  of sound at  the lowest  sampling rate!
Therefore, instead of calculating  the function for every  sample, an
array is  filled with  the values  of the  function.  Then,  for each
sample, the value is read out of the appropriate entry in  the array,
instead of calculating it.   Of course, for many kinds  of functions,
the value will not be as exact, but it is usually adequate for use in
music.  There are unit generators which do interpolation,  instead of
a simple array lookup, and these will produce accurate  enough values
for most critical cases.



6-1  Controlled Calling Rates
___  __________ _______ _____


In  many  cases,  a  function  does  not  change  rapidly  with time.
Therefore to save computer time, it would be desirable not to have to
call the unit  generator for every sample.   This, which is  called a
controlled  calling  rate,  is  expressed  by  placing   a  bracketed
expression immediately  following the unit  generator name in  a unit
generator call.

Example:

        OSCIL[10](P4,10*MAG/P2,F1);

Calls the unit generator OSCIL every tenth sample, and uses  the same
value for the other nine samples.



6-2  VFMULT
___  ______


Argument list:

        1 - Amplitude
        2 - Subscript
        3 - Array

                               Page 16
Music Manual                                          Unit Generators


VFMULT multiplies the first  argument times the element of  the array
described by the  second argument. If  the second argument  is getter
than the array length, it is reduced by that array length until it is
within the size of the array.



6-3  LINEN
___  _____


Argument list:

        1 - Amplitude
        2 - Rise time/Total time
        3 - Decay time/Total time
        4 - Total time
        5 - Array
        6 - Initial point in array

This function uses a 384 word array in three sections, to generate an
envelope  function with  separate  rise time,  intermediate  time and
decay  time.  The  rise time  and decay  time are  a function  in the
second argument, third argument and the total time.  Their  values in
seconds may be calculated according to the following formula.

                     rise time = (arg2/arg4)*P2
                     decay time = (arg3/arg4)*P2

Examples:

To obtain a rise time of .1 seconds and a decay time of .4 seconds,

LINEN(P4,.1,.4,P4,F1,TMP←0);

To obtain a 10 rise time and a 33.3 decay time,

LINEN(P4,10,33.3,100,F1,TMP←0);


The initial point in array  must be a variable and should  usually be
zero. (If it is a constant, you will clobber that constant!).



6-4  VALUE
___  _____


Argument list:

                               Page 17
Music Manual                                          Unit Generators


        1 - Expression

VALUE is a special  unit generator which returns its  first parameter
as  its value.   Its  sole reason  for  existent is  to  allow R-time
expressions to be evaluated with a controlled calling rate.

Example:

VALUE[100](RV←A*SIN(X));




6-5  The OSCIL family of Unit Generators
___  ___ _____ ______ __ ____ __________


OSCIL is short for oscillator. An OSCIL outputs successive  values of
the function (or waveform) stored  in an array.  When it  reached the
end of that array, it `wraps around' and starts back at the beginning
of  the array.   The  rate at  which it  moves  down the  array  is a
parameter  called  the  increment,  measured  in  array  elements per
sample,  which  is equal  to  the frequency  times  the  array length
divided  by the  sample rate.  For convenience,  there is  a variable
called MAG which is set to 512/SRATE, 512 being the length  of arrays
       ___                 _________  ___
used here and SRATE being the sample rate.  Since most functions used
              _____
with OSCIL range  between -1 and 1,  there is a parameter  called the
amplitude, by  which the value  of the function  is multiplied  by to
produce the value of unit generator.  The typical order  of arguments
is:

        1 - Amplitude
        2 - Increment
        3 - Array

The following are the many kinds of OSCIL's:

OSCIL:
_____

OSCIL always starts at the beginning of the array when the instrument
is called and will produce  an error message if a  negative increment
is supplied.

NOSCIL:
______

NOSCIL  always  starts  at  the  beginning  of  the  array  when  the
instrument is called and will accept a negative argument.

COSCIL:
______

                               Page 18
Music Manual                                          Unit Generators


COSCIL starts wherever it left off the last time that  instrument was
called.  (If there are more than one COSCIL's in an  instrument, they
do not effect each other.)  COSCIL will accept a negative argument.

EXPEN:
_____

EXPEN always  starts at  the beginning  of the  array and  instead of
'wrapping around` when it reachs the end, it always returns  the same
value upon subsequent calls.

NOSCA:
_____
Argument list:

        1 - Initial index in array
        2 - Amplitude
        3 - Increment
        4 - Array

NOSCA is a special form of  NOSCIL which sets where it starts  in the
array to the value of the first argument.



6-6  The ZOSCIL Family of Unit Generators
___  ___ ______ ______ __ ____ __________


ZOSCIL interpolates  between the two  closest array  elements, rather
that doing a straight lookup.  If it reaches the end of an  array, it
will  interpolate between  the last  element and  the  first element,
which   may   produce  unexpected   (but   consistent)   results  for
discontinuous functions.   ZOSCIL always starts  at the  beginning of
the array and will accept a negative increment. Parameter list:

        1 - Amplitude
        2 - Increment
        3 - Array

CZOSCIL:
_______

CZOSCIL interpolates between  the two closest array  elements, rather
that doing  a straight  lookup.  Like COSCIL,  it starts  wherever it
left off the list time the instrument was called. CZOSCIL will accept
negative increment.

ZEXPEN:
______

ZEXPEN is  like a  EXPEN except ZEXPEN  interpolates between  the two


                               Page 19
Music Manual                                          Unit Generators


closest array  elements, rather  that doing  a straight  lookup. Like
EXPEN, instead of 'wrapping around` when it reachs the end, it always
returns the same value upon subsequent calls.

ZOSCA:
_____
Argument list:

        1 - Initial point in array
        2 - Amplitude
        3 - Increment
        4 - Array

ZOSCA is a special form of  ZOSCIL which sets where it starts  in the
array to the value of the first argument.



































                               Page 20
Music Manual


                              SECTION 7
                              _______ _

                         Built-in Functions
                         ________ _________






7-1  SYNTH
___  _____


This is a FORTRAN subroutine, usually loaded with the Compiler, which
allows arrays to be loaded with the sum and/or product of sine waves.
To use  SYNTH, you must  dimension an array  to the  appropriate size
(presently 512) and call it with SYNTH(<array name>). You should then
                                 ____________ ______
input four numbers:

    1) the harmonic (denoted by H),
    2) the amplitude (denoted by A),
    3) the phase angle in degrees (denoted by P), and
    4) a constant with is added to the amplitude (denoted by K).

If K is  greater than 100  then it will  multiply instead of  add the
sine wave described.  It is terminated by the single entry of 999 for
H.  If you are at a III display,  after the four parameters,  the new
state of the array will be displayed.

There is a version of SYNTH which will save the array on a file  in a
form  which  may be  read  by  the Compiler.   See  Leland  Smith for
details.



7-2  SEG
___  ___


Like SYNTH, this  is a subroutine  usually loaded with  the Compiler.
It allows  arrays to  be defined as  line segments.   To use  is, you
first must dimension an array to the appropriate size (presently 512)
and  call the  function  with SEG(<array  name>).   If you  are  at a
                              __________  ______
display, it will display the  array as you load it. It  expects input
of two  numbers, the amplitude  and the position  in the array,  on a
scale from  0 to  100.  It  is terminated by  the entry  of 100  as a
position.

There is a version  of SEG which will save  the array on a file  in a


                               Page 21
Music Manual                                       Built-in Functions


form  which  may be  read  by  the Compiler.   See  Leland  Smith for
details.



7-3  SEE
___  ___


Argument list:

1 - Array to be displayed

This routine displays the content of an array. It is called  with the
array to be displayed as  an argument in the form  SEE(<array name>).
                                                   __________ ______
Type  0<return> when  you are  done looking  at the  display  and the
      _
display will be cleared.



7-4  SETSPEED
___  ________


No Arguments

SETSPEED may be used to  setup NCHNS, SPEED, SRATE, and MAG  to their
                               _____  _____  _____      ___
appropriate values.  When called, it asks for the number  of channels
and sample rate,  and calculates what speed  to use.  If there  is no
speed for that combinate of  channels and sample rate, it asks  for a
new sample rate.   It then sets MAG  to 512/SRATE and prints  the new
                                ___     _________
SPEED.
_____



7-5  PRINT
___  _____


Argument list:

        1 - Number to be printed

Prints an integer  or floating point  number.  It is  mostly obsolete
and is here for  the use in compatablity  (see Page 12).  For  use in
FORTRAN  programs,  there  is   a  function  called  PNUM   which  is
                                                     ____
approximately equivalent to  PRINT. FORTRAN I/O is  incompatable with
NEWMUS and  attempts to  use it  will result  in various  errors like
ILLEGAL UUO AT XXX The difference in names is because the  name PRINT
would conflict with FORTRAN.


                               Page 22
Music Manual                                       Built-in Functions


7-6  RDNUM
___  _____


Argument list:

        1 - Variable to recieve number

Inputs a number  from the current  input device.  Returns  a floating
point number.  Callable from FORTRAN, as FORTRAN I/O  is incompatable
with NEWMUS.



7-7  RAND
___  ____


Generates pseudo-random numbers between -1 and 1(1).



7-8  INT
___  ___


Argument list:

        1 - Number

Returns the integer part, or to be more precise the  entier function.
For example:

INT(123.456)=123
INT(-123.45)=-124














_______________________
(1) Currently, RAND does not generate statistically random numbers.

                               Page 23
Music Manual                                       Built-in Functions





7-9  FORTRAN Functions
___  _______ _________


The following functions are loaded from the FORTRAN Library:

        SQRT(X)            Square root
        _______

        SIN(X)             Sine in radians
        ______
        SIND(X)            Sine in degrees
        _______

        COS(X)             Cosine in radians
        ______
        COSD(X)            Cosine in degrees
        _______

        ALOG(X)            Natural logarithm
        _______
        ALOG10(X)          Logarithm base 10
        _________

        ABS(X)             Absolute value
        ______
                            x
        EXP(X)             e
        ______



























                               Page 24
Music Manual


                              SECTION 8
                              _______ _

                            Making Music
                            ______ _____




<play block>      ::= PLAY <play list>
<play list>       ::= <instrument call>;<play list>|
                      <statement>;<play list>|FINISH
<instrument call> ::= <instrument><parameter list>






































                               Page 25
Music Manual


                             Appendix A
                             ________ _

                               Syntax
                               ______




Note:  {<foo>} means there may be from 0 to ∞ occurances of <foo>.

<block>                 ::= BEGIN <declaration list>;<statement list>
<declaration list>      ::= <declaration>;<declaration list>|
                            <declaration>
<statement list>        ::= <statement>;<statement list>|END
<statement>             ::= <function call>|<unit generator call>|
                            <WHILE statement>|<UNTIL statement>|
                            <FOR statement>|<conditional statement>|
                            <PRINT statement>|<assignment statement>|
                            <block>
<statement>             ::= <function call>|<unit generator call>|
                            <FOR statement>|<PRINT statement>|
                            <block>|<assignment statement>
<function call>         ::= <function>(<parameter list>)
<unit generator call>   ::= <unit generator>(<parameter list>)|
                     <unit generator>[<expression>](<parameter list>)
<parameter list>        ::= <parameter>,<parameter list>|<parameter>
<parameter>             ::= <expression>|<array>|<string constant>
<FOR statement>         ::= FOR <variable>←<expression> STEP
                            <expression> UNTIL <expression> DO
                            <statement>
<PRINT statement>       ::= PRINT <print list>
<print list>            ::= <expression>,<print list>|<expression>|
                            <string constant>,<print list>|
                            <string constant>
<WHILE statement>       ::= WHILE <conditional> DO <statement>
<UNTIL statement>       ::= DO <statement> UNTIL <conditional>
<assignment statement>  ::= <variable>←<expression>
<extended commands>     ::= EXIT|P <integer>|PRINT <expression>;|
                            RESET|FREEZE|SPACE|DDT|
                            <declarator> LIST
<declarator>            ::= VARIABLE|ARRAY|FUNCTION|INSTRUMENT|
                            UNIT_GENERATOR
<declaration>           ::= <variable declaration>|
                            <array declaration>
<variable declaration>  ::= VARIABLE <var. dec. list>
<var. dec. list>        ::= <identifier>,<var. dec. list>|
                            /<identifier>,<var. dec. list>|
                            <identifier>|/<identifier>
<array declaration>     ::= ARRAY <array decl. list>

                               Page 26
Music Manual                                                   Syntax


<array decl. list>      ::= <array decl. group>,<array decl. list>|
                            <array decl. group>
<array decl. group>     ::= <variable>,<array decl. group>|
                            <variable>(<constant>)
<expression>            ::= <term>|<term><addop><expression>
<term>                  ::= <factor>|<factor><mulop><term>
<factor>                ::= <primary>
<primary>               ::= -<primary>|(<expression>)|<variable>|
                            <function call>|<unit generator call>|
                            <array name>(<expression>)|<constant>
                            <variable>←<expression>
<addop>                 ::= +|-
<mulop>                 ::= *|/
<variable>              ::= <letter><var tail>|<letter>
<var tail>              ::= <alphanumeric><var tail>|<alphanumeric>
<alphanumeric>          ::= <letter>|<number>
<letter>                ::= A|B|C|...Z|_|$|#
<digit>                 ::= 0|1|2|...9































                               Page 27
Music Manual


                             Appendix B
                             ________ _

                           Reserved Words
                           ________ _____














































                               Page 28
Music Manual                                           Reserved Words


<ARRAY<BEGIN<CO
_______________
















































                               Page 29
Music Manual


                             Appendix C
                             ________ _

                           Error Messages.
                           _____ _________




A simple statement inside a 'COMPILE' section just wastes space!
It will never be executed.

AD error
Error detected while outputing to the DAC.

Attempt to reference unit generator output at R-Time
At I-time, the output of a unit generator is undefined.

C O M P I L E R   E R R O R  ! ! ! Get TOVAR or save this core image 
Something  unexpected has  happened  which would  probably  should be
looked at as it is most likely a bug.

Can't INIT AD
Digital to Analog Converter is probably in use.

Can't INIT DSK!
An unlikely situation.

Can't INIT TTY!
An unlikely situation.

Can't INIT mag tape
Someone else is probably using it.

Can't OPEN output file

Can't delete .SAV file
Perhaps someone is referencing it.

Can't expand core!
Could get enough core.  You lose.

Can't have an R-time statement controlled by an I-time conditional
The  DO  ...  UNTIL   statement  will  never  terminate   under  such
circumstances.

Can't re-INIT output device.
Someone else it probably using it.

Can't reduce core!

                               Page 30
Music Manual                                          Error Messages.


Shouldn't happen.

Can't setup buffers for output
This error is probably due to some change to I/O in system.

DONE statement illegal here

DRYROT IN MAG. TAPE ROUTINE

Dangling ELSE or extraneous ';' in IF...THEN...ELSE statement
The statement following the 'THEN' in a IF...THEN...ELSE statement is
terminated by the ELSE and should not have a semicolon after it.

Declarations should be made at start of block
You may continue from this error.

Dimension should be a number
Dynamic arrays are not implimented.

ERROR IN READING THE BITMAP/DIRECTORY

ERROR IN SETTING UP BUFFER RINGS

ERROR IN WRITING BITMAP!

ERROR IN WRITING TAPE DIRECTORY!
The tape files were  written correctly, however, the  directory could
not be written out properly.  Use tape fixing program on this one.

EXIT statement illegal outside of block

EXPRESSION TOO COMPLEX, MAY BE A COMPILER BUG

Expected to find a '←' here
The compiler assumed you meant as assingment statement.

External functions only, please
The compiler does not know about anything else being external.

FORWARD REF. TO UNIT GENERATOR
You have most likely referenced the output of a unit  generator which
have  not  been defined  yet.  [If there  are  no Un  symbols  in the
expression, it may be a compiler bug.]

I'M NOT SURE I THIS WILL WORK, TYPE <RETURN

ILLEGAL DEBUGFLAG SETTING


                               Page 31
Music Manual                                          Error Messages.


ILLEGAL FILE NAME

ILLEGAL FORMAL PARAMETER

IMPROPER ARRAY PARAMETER

IMPROPER STRING PARAMETER

INIT failed for that device

INPUT ERROR

INTEGERS PRESENTLY ALLOWED ONLY FOR EXTERNAL FUNCTIONS, SORRY

Illegal character in number
Not a digit or decimal point.

Illegal character
A character was found in file which has no meaning to the compiler.

Illegal declaration
You  may not  make a  declaration of  type UNIT_GENERATOR,  STRING or
INTEGER.

Illegal primary

Illegal primary
Should be a number, variable, array or function call.

It appears that your tape directory has been garbaged.
Read error or some sort of inconsistancy on directory.

MAG TAPE ERROR???!?

MAG. TAPE ERROR

Missing '(' after array
You are probably trying to use a array as a variable.  Arrays must be
subscripted.

Missing '(' in array declaration

Missing '(' in function call

Missing ')' after array subscript

Missing ')' in array declaration


                               Page 32
Music Manual                                          Error Messages.


Missing ')' in expression
Unbalanced parentheses or missing operator in expression.

Missing ')' in function definition

Missing ')' or too many parameters in function call

Missing ';' or '=' in function definition

Missing ';'

Missing ';'
Statements should be terminated with a semicolon

Missing 'BEGIN' in function definition

Missing 'DO' in FOR

Missing 'END'

Missing 'STEP' in FOR

Missing 'THEN'
'THEN' Missing in IF...THEN...ELSE Statement.

Missing 'UNTIL' in FOR

Missing 'UNTIL'
UNTIL missing from DO ... UNTIL statement or extraneous ';`.

Missing ']' in unit generator call

Missing '←' in FOR

Missing DO in WHILE statement

Missing END
FINISH statement giving inside a block.

Missing External function
Either  an  external  function  was  not  loaded  or  its   name  was
misspelled.

Missing IDENTIFIER

Multiply defined symboi

Multiply dimensional array not implimented, sorry

                               Page 33
Music Manual                                          Error Messages.


Multiply dimensioned arrays not implemented
You may also have confused an array name with a function name.

NEGATIVE INC. TO OSCIL
OSCIL is not defined to go accept a negative increment however if you
continue from  this error it  will treat this  increment as  a NOSCIL
does.

NOT ALLOWED IN 'PLAY' SECTION

Negative increment to LINEN
LINEN  is  undefined for  negative  increments.  The  results  may be
unpredicatable.

Negative increment to ZEXPEN
ZEXPEN is undefined for  negative increments however if  you contiune
it will treat it like a ZOSCIL.

Output error?
Error detected while writing out sample buffer

PARITY ERROR ON MAG. TAPE

R-Time condition for I-Time Statement in WHILE statement
No R-Time  code was  generated after an  R-Time conditional.    It is
most likely that this will result in an infinite loop!

R-Time conditional for I-time IF-THEN-ELSE statement
No R-time code was  generated after an R-Time  conditional. Therefore
the IF-THEN statement acts as  if the condition were always  true for
the 'THEN' clause and always false for the 'ELSE' clause!

RETURN statement illegal outside of function definition
Only functions may return a value.  Use EXIT to leave a block.

SETPR2 failed! Therefore, can't do output to mag tape.
The program peeks  at the monitor  to find out  what the mag  tape is
doing.  The UUO which permits this failed.

STRING REQUIRED HERE

Simple variable required here
FOR loops expect a simple variable, i.e. not an array.

Storage full!

String too long or missing "
Strings have a limited length.

                               Page 34
Music Manual                                          Error Messages.


Subscript out of bounds at compile time.
You have a subscript  expression which evaluates to a  constant which
is either too large or too small.

TAPE FULL

This feature can not be used on DEC systems yet. Sorry.
There are  some things you  can do  at Stanford that  you can  not do
elsewhere.

This isn't FORTRASH. Use a '←' assignment next time
However '=' will be accepted under protest.

Too few arguments in function call

Too many END statements

Too many parameters in function call

UDP in use or assignned to another job

UNDEFINED IDENTIFIER

UNDEFINED IDENTIFIER
An identifier was used before it was declared.

Undefined IDENTIFIER

Unexpected symbol beginning a statement
It will be ignored and attempt to continue compilation.

Unimplimented operation
AND and OR are not implimented.

Unit Generator call illegal outside of instrument definition
Unit generators  are only to  be used inside  of instruments  as they
require special initialization at I-time.

Unit generator call illegal outside of instrument definition
Unit generators  are only to  be used inside  of instruments  as they
require special initialization at I-time.

Use of two relational operator is illegal here

You are calling an instrument which is already running!
Since the code generated for INSTRUMENTS is non-reentrant, you should
not call  it twice  while its  already running  as this  will produce


                               Page 35
Music Manual                                          Error Messages.


unpredicable  results.  Instead  you  should make  a copy  of  with a
different  name and  different variable  names if  they  are declared
outside that instrument

You have the wrong pack mounted on the UDP
The password for the UDP scratch pack was not correct.











































                               Page 36
                            Music Manual


                              I N D E X

                  (References are to Page numbers)


 rise time and a 33.3  17           LINEN  17
                                    LIST  15
ABS  24                             local variables  6
Absolute value  24                  Logarithm  24
argument  6
Assignment Statement  12            NOSCA  19
Assignment statement}is done to     NOSCIL  18
   one of the  6
                                    OSCIL  18
BEGIN  13
BIGBIT  2                           P_Array  4
Block  13                           Plays  14
                                    PNUM  22
called by reference  6              PRINT  12, 14, 22
Controlled Calling Rates  16
COSCIL  18                          RAID  15
Cosine  24                          RAND  23
CZOSCIL  19                         RDNUM  23
                                    Reserved Words  28, 29
DDT  15                             RESET  14
Declaration  4, 5, 6, 7             RETURN  6
DMD  2
                                    SEE  22
END  13                             SEG  21
EXCISE  14                          SETSPEED  22
EXIT  14                            Sine  24
EXP  24                             SPACE  14
EXPEN  19                           Square root  24
Exponent  25                        Statement  10, 11, 12, 13
Expressions  8                      subroutine  9, 10
Extended Commands  14, 15           Syntax  26, 27
External  7                         SYNTH  21

FOR Statement  11                   UDPLAY  3
formal parameter  6                 Unit Generator  10
FORTRAN I/O  22                     Unit Generators  16, 17, 18, 19,
FREEZE  14                             20
Function Call  8, 10                UNTIL Statement  11

identifier  4                       VALUE  17
increment  18                       VFMULT  16
INT  23
                                    WHILE Statement  11

                               Page 37
                            Music Manual







ZEXPEN  19
ZOSCA  20










































                               Page 38